from datetime import datetime
from typing import Optional
from pydantic import BaseModel, ConfigDict
from .base_schema import BaseSchema


class PayOrderBase(BaseSchema):
    order_no: str
    order_type: int
    pay_type: int
    merc_no: str
    #factor_no: Optional[str]
    amount: int
    fee: int
    status: int
    '''
    model_config = ConfigDict(
        #strict=True,
        from_attributes=True
    )
    '''

class PayOrderSchema(PayOrderBase):
    chn_resp_msg: Optional[str]
    create_time: Optional[datetime]
    update_time: Optional[datetime]
    
class PayOrderFullSchema(PayOrderBase):
    up_chn_order_no: Optional[str]
    #up_chn_merc_no: Optional[str]
    #pay_chn_code: Optional[str]
    #pay_chn_name: Optional[str]
    #chn_resp_code: Optional[str]
    chn_resp_msg: Optional[str]
    #is_profit_processed: Optional[str]
    create_time: Optional[datetime]
    update_time: Optional[datetime]

class NewPayOrder(BaseSchema):
    order_type: int
    merc_no: str
    factor_no: str
    amount: int

class NewOrderResp(PayOrderBase):
    merc_order_no: Optional[str] = ''
    chn_resp_code: Optional[str]
    chn_resp_msg: Optional[str]

class NewOrderNotice(BaseSchema):
    order_no: str
    merc_order_no: str
    notify_url: str
    status: int = 0
    fail_count: int = 0
